package com.baizhiedu.beanpost;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * ClassName: MyBeanPostProcessor
 * Description:
 * Date: 2022/11/21 AM 11:22:42
 * <p>
 * project: spring5
 * package: com.baizhiedu.beanpost
 * email: 1085844536@qq.com
 * version:
 *
 * @author WangGuojian
 */
public class MyBeanPostProcessor implements BeanPostProcessor {

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if (bean instanceof Category) {
            Category category = (Category) bean;
            category.setName("xiaowb");
        }
        return bean;
    }
}
